<include file="Layout/header" />
<body>
<div class="breadcrumbs" id="breadcrumbs"> 
  <script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>
  <ul class="breadcrumb">
    <li> <i class="icon-home home-icon"></i> <a href="#">首页</a> </li>
    <li class="active">编辑文章</li>
  </ul>
</div>
<div class="page-content">
  <div class="page-header">
    <h1> 文章列表 <small> <i class="icon-double-angle-right"></i> 编辑文章 </small> </h1>
  </div>
  <!-- /.page-header -->
  
  <div class="row">
    <div class="col-xs-12"> 
      <!-- PAGE CONTENT BEGINS -->
      <div class="row-fluid">
        <div class="span12">
          <div class="widget-box">
            <div class="widget-header widget-header-blue widget-header-flat">
              <h4 class="lighter">编辑文章信息</h4>
            </div>
            <div class="widget-body">
              <div class="widget-main">
                <div class="step-content row-fluid position-relative" id="step-container">
                  <div class="step-pane active" id="step1">
                    <!-- <h3 class="lighter block green">Enter the article information</h3> -->
                    <form class="form-horizontal" action="{:U('Admin/Article/article_edit')}" id="validation-form" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="article_id" value="{$article_id}" >
                        <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_title">文章标题:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <input type="text" id="article_title" name="article_title" value="{$article_array.article_title}" class="col-xs-12 col-sm-5" />
                          </div>
                        </div>
                      </div>
                      
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="ac_id">文章分类:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <select class="input-medium" id="ac_id" name="ac_id" style="width:41.6666%;">
                                <option value="">---------请选择文章分类---------</option>
                                  <volist name="parent_list" id="val">
                                  <if condition="$article_array.ac_id eq $val.ac_id " >
                                  <option  value="{$val.ac_id}" selected="selected" >{$val.ac_name}</option>
                                  <else/>
					              <option  value="{$val.ac_id}">{$val.ac_name}</option>
                                  </if>
                                  </volist>
							</select>
                          </div>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="site_keywords">排序值:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <input type="text" id="article_sort" name="article_sort" value="{$article_array.article_sort}" class="col-xs-12 col-sm-5" />
                          </div>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_abstract">文章摘要</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <textarea class="input-xlarge" name="article_abstract" id="article_abstract" style="width:41.6666%;">{$article_array.article_abstract}</textarea>
                          </div>
                        </div>
                      </div>
                      <div class="hr hr-dotted"></div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_author">文章作者:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <input type="text" name="article_author" id="article_author" value="{$article_array.article_author}" class="col-xs-12 col-sm-5" />
                          </div>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_source">文章来源:</label>
                        <div class="col-xs-12 col-sm-9">
                           <div class="clearfix">
                            <input type="tel" id="article_source" name="article_source" value="{$article_array.article_source}" class="col-xs-12 col-sm-5" />
                          </div>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_url">来源连接:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                            <input type="text" name="article_url" id="article_url" value="{$article_array.article_url}" class="col-xs-12 col-sm-5" />
                          </div>
                        </div>
                      </div>
                       
                      <div class="hr hr-dotted"></div>
                       
                      <div class="space-2"></div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否发布</label>
                        <div class="col-xs-12 col-sm-9">
                          <div>
                            <label class="blue">
                              <input name="article_show" value="0" type="radio" class="ace" <if condition="$article_array.article_show eq 0">checked</if> />
                              <span class="lbl"> 否</span> </label>
                          </div>
                          <div>
                            <label class="blue">
                              <input name="article_show" value="1" type="radio" class="ace" <if condition="$article_array.article_show eq 1">checked</if>/>
                              <span class="lbl"> 是</span> </label>
                          </div>
                        </div>
                      </div>
                      
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="article_img">缩略图:</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix" style="width:41.6666%;">
 							 <input type="file" id="id-input-file-2" name="article_img" />
                             <if condition="$article_array.article_img neq ''">
							 <img src="/data/upload/article/{$article_array.article_img}" width="200" height="100"/>
                             </if>
                          </div>
                        </div>
                      </div>
                      
                      <div class="hr hr-dotted"></div>
                      
                      <div class="space-2"></div>
                      <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-3 no-padding-right" for="site_comment">文章内容</label>
                        <div class="col-xs-12 col-sm-9">
                          <div class="clearfix">
                          <?php showEditor('article_content',$article_array['article_content']);?>
                          </div>
                        </div>
                      </div>
                      <div class="clearfix form-actions">
                        <div class="col-md-offset-3"><input class="btn btn-primary radius" type="submit" id="submitBtn" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"></div>
                      </div>
                    </form>
                  </div>
                </div>
                
              </div>
              <!-- /widget-main --> 
            </div>
            <!-- /widget-body --> 
          </div>
        </div>
      </div>
      
      <!-- PAGE CONTENT ENDS --> 
    </div>
    <!-- /.col --> 
  </div>
  <!-- /.row --> 
</div>
<!-- /.page-content --> 

<!-- /#ace-settings-container --> 
<!--[if !IE]> -->

		<script src="/Public/Admin/js/jquery-2.0.3.min.js"></script>

		<!-- <![endif]--> 

<!--[if IE]>
<script src="/Public/Admin/js/jquery-2.0.3.min.js"></script>
<![endif]--> 

<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='/Public/Admin/js/jquery-2.0.3.min.js'>"+"<"+"script>");
		</script>

		<!-- <![endif]--> 

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='/Public/Admin/js/jquery-1.10.2.min.js'>"+"<"+"script>");
</script>
<![endif]--> 

<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='/Public/Admin/js/jquery.mobile.custom.min.js'>"+"<"+"script>");
		</script> 
<script src="/Public/Admin/js/bootstrap.min.js"></script> 
<script src="/Public/Admin/js/typeahead-bs2.min.js"></script> 

<!-- page specific plugin scripts --> 

<!--[if lte IE 8]>
		  <script src="/Public/Admin/js/excanvas.min.js"></script>
		<![endif]--> 

<!-- ace scripts --> 

<script src="/Public/Admin/js/ace-elements.min.js"></script> 
<script src="/Public/Admin/js/ace.min.js"></script> 
<script src="__ADMIN_JS__/jquery.validate.min.js"></script> 
<script type="text/javascript">
			 
$(document).ready(function(){
                $('#id-input-file-2').ace_file_input({
					no_file:'没有选择文件',
					btn_choose:'选择',
					btn_change:'更改',
					droppable:false,
					onchange:null,
					thumbnail:false //| true | large
					//whitelist:'gif|png|jpg|jpeg'
 					//blacklist:'exe|php'
					//onchange:''
					//
				});

	
    $("#submitBtn").click(function(){ 
         $("#validation-form").submit();
    });
	$('#validation-form').validate({
		errorElement: 'div',
		errorClass: 'help-block',
		focusInvalid: false,
        rules : {
        	            
 						article_title: {
							required: true
						},
						ac_id: {
							required: true
						},
						article_url: {
						//	required: true,
							url: true
						},
 						article_show: 'required',
						 
        },
        messages : {
      		            
						article_title: {
							required: "站点名称不能为空"
						},
						ac_id: {
							required: "请选择文章所属分类"
						},
						article_url: {
							url: "请输入合法url"
						},
 						article_show: "请选择是否开启站点"
						 
        },
		 
			
					highlight: function (e) {
						$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
					},
			
					success: function (e) {
						$(e).closest('.form-group').removeClass('has-error').addClass('has-info');
						$(e).remove();
					},
			
					errorPlacement: function (error, element) {
						if(element.is(':checkbox') || element.is(':radio')) {
							var controls = element.closest('div[class*="col-"]');
							if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
							else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
						}
						else if(element.is('.select2')) {
							error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
						}
						else if(element.is('.chosen-select')) {
							error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
						}
						else error.insertAfter(element.parent());
					},
			
					submitHandler: function (form) {
						$(form).ajaxSubmit();
			            var index = parent.layer.getFrameIndex(window.name);
			            //parent.$('.btn-refresh').click();
			            parent.layer.close(index);
					}
					 
    });
});
		</script>
</body>
</html>